package com.lottery.service.pc28.customService;

import com.lottery.entity.CommunionMsg;

import java.util.ArrayList;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class CostomerServer {
	private int id;

	private int count;

	private byte isIdle; // 0 空闲， 1繁忙

	private int maxServer;

	// private Lock lock;
	// private ArrayList<CommunionMsg> messageList;
	private Map<Integer, ArrayList<CommunionMsg>> clientMsgMap;

	public Map<Integer, ArrayList<CommunionMsg>> getMessageList() {
		return clientMsgMap;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	// public Lock getLock() {
	// return lock;
	// }
	//
	// public void setLock(Lock lock) {
	// this.lock = lock;
	// }

	public CostomerServer() {
		initial();
	}

	public CostomerServer(int id, int maxServer) {
		this.id = id;
		this.count = 0;
		this.isIdle = 1;
		this.maxServer = maxServer;
		this.clientMsgMap = new ConcurrentHashMap<Integer, ArrayList<CommunionMsg>>();
		// lock = new ReentrantLock();
		initial();
	}

	public byte getIsIdle() {
		return isIdle;
	}

	public void setIsIdle(byte isIdle) {
		this.isIdle = isIdle;
	}

	public void ServerCountAdd() {
		count++;
	}

	public void ServerCountReduce() {
		if (count > 0)
			count--;
	}

	public int getMaxServer() {
		return maxServer;
	}

	public void setMaxServer(int maxServer) {
		this.maxServer = maxServer;
	}

	void initial() {
	}

}
